import type { useMaterialStore } from "@/stores/useMaterial";
import type { IJsonSchema } from "./common";
import type {
  IJsonSchemaStatusBase,
  IJSStatusItemOptions,
  IJSStatusItemText,
} from "./editProps";
import type { useEditorStore } from "@/stores/useEditor";
import type { Component } from "vue";

// ^ 所有基础业务组件名称
export type IBaseComsUnions =
  | "single-select"
  | "single-pic-select"
  | "text-note"
  | "multiple-select"
  | "option-select"
  | "multiple-pic-select"
  | "text-input"
  | "rate-score"
  | "date-select";

// ^ 所有预设业务组件名称
export type IPreSettingComsUnions =
  | "personal-info-name"
  | "personal-info-id"
  | "personal-info-gender"
  | "personal-info-age"
  | "personal-info-education"
  | "personal-info-career"
  | "personal-info-birth"
  | "personal-info-collage"
  | "personal-info-major"
  | "personal-info-industry"
  | "personal-info-company"
  | "personal-info-position"
  | "contact-way-phone"
  | "contact-way-wechat"
  | "contact-way-qq"
  | "contact-way-email"
  | "contact-way-address";

// ^ 所有编辑组件名称
export type IEditorComsUnions =
  | "title-editor"
  | "desc-editor"
  | "position-editor"
  | "options-editor"
  | "size-editor"
  | "color-editor"
  | "weight-editor"
  | "italic-editor"
  | "width-editor"
  | "text-input-type-editor"
  | "remark-type-editor"
  | "pic-options-editor"
  | "date-type-editor"
  | "rate-setting-editor"
  | "title-devider-editor"
  | "desc-devider-editor";

// ^ 所有业务组件名称
export type IComsUnions = IBaseComsUnions | IPreSettingComsUnions;

// ^ 所有组件名称(业务组件 + 编辑组件)
export type IAllComsUnions = IComsUnions | IEditorComsUnions;

// ^ 所有业务组件对应Json Schema映射对象
export type IComsJsonSchemaMap = Record<IComsUnions, IJsonSchema>;

// ^ 所有组件名称(业务组件 + 编辑组件)对应组件对象映射对象
export type IAllComsUnionsMap = Record<IAllComsUnions, Component>;

// ^ store公用的actions函数类型
export interface IActions {
  setTextStatus: (props: IJSStatusItemText, status: string) => void;
  addOptionStatusItem: (props: IJSStatusItemOptions) => void;
  deleteOptionStatusItem: (
    props: IJSStatusItemOptions,
    index: number,
  ) => boolean;
  setStatusIndex: (props: IJSStatusItemOptions, index: number) => void;
  setPicSelectOptionItem: (
    props: IJSStatusItemOptions,
    index: number,
    link: string,
  ) => void;
  changeEditorVisible: (status: IJsonSchemaStatusBase, type: number) => void;
  setRateIsUse: (status: IJsonSchemaStatusBase, isUse: boolean) => void;
}

// ^ 业务组件库store类型
export type IMaterialStore = ReturnType<typeof useMaterialStore>;

// ^ 编辑器store类型
export type IEditorStore = ReturnType<typeof useEditorStore>;
